package com.micro.frog.fortune.util;

/**
 * @author Jason.lv
 * @since 2022/2/22 15:25
 */
public class PageUtil {

  public static long page(long page) {
    return page <= 0 ? 1 : page;
  }

  public static long pageSize(long pageSize) {
    pageSize = pageSize <= 0 ? 10 : pageSize;
    return Math.min(pageSize, 1000);
  }

  public static long pages(long total, long pageSize) {
    return total / pageSize + (total % pageSize > 0 ? 1 : 0);
  }

}
